package com.fang.tread0;
//如果不想成为一个线程，可以直接实现Runnable
public class MyThread02 implements Runnable {
   Thread th;

    public Thread getTh() {
        return th;
    }

    public void setTh(Thread th) {
        this.th = th;
    }

    @Override
    public void run() {

        for (int i = 0; i <10 ; i++) {
            System.out.println(i+":"+"MyThread02");

            try {
                if (i==5){
                    th.join();
                }
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}
